<?php

/**
 * This is the model class for table "bayiimunisasi".
 *
 * The followings are the available columns in table 'bayiimunisasi':
 * @property integer $bim_id
 * @property integer $bim_kec
 * @property integer $bim_campak
 * @property integer $bim_bcg
 * @property integer $bim_dpthb1
 * @property integer $bim_dptbh2
 * @property integer $bim_dpthb3
 * @property integer $bim_tt1
 * @property integer $bim_tt2
 * @property integer $bim_polio1
 * @property integer $bim_polio2
 * @property integer $bim_polio3
 * @property integer $bim_polio4
 *
 * The followings are the available model relations:
 * @property Kecamatan $bimKec
 */
class Bayiimunisasi extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Bayiimunisasi the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'bayiimunisasi';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('bim_kec, bim_campak, bim_bcg, bim_dpthb1, bim_dptbh2, bim_dpthb3, bim_tt1, bim_tt2, bim_polio1, bim_polio2, bim_polio3, bim_polio4', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('bim_id, bim_kec, bim_campak, bim_bcg, bim_dpthb1, bim_dptbh2, bim_dpthb3, bim_tt1, bim_tt2, bim_polio1, bim_polio2, bim_polio3, bim_polio4', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'bimKec' => array(self::BELONGS_TO, 'Kecamatan', 'bim_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'bim_id' => 'Bim',
			'bim_kec' => 'Bim Kec',
			'bim_campak' => 'Bim Campak',
			'bim_bcg' => 'Bim Bcg',
			'bim_dpthb1' => 'Bim Dpthb1',
			'bim_dptbh2' => 'Bim Dptbh2',
			'bim_dpthb3' => 'Bim Dpthb3',
			'bim_tt1' => 'Bim Tt1',
			'bim_tt2' => 'Bim Tt2',
			'bim_polio1' => 'Bim Polio1',
			'bim_polio2' => 'Bim Polio2',
			'bim_polio3' => 'Bim Polio3',
			'bim_polio4' => 'Bim Polio4',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('bim_id',$this->bim_id);
		$criteria->compare('bim_kec',$this->bim_kec);
		$criteria->compare('bim_campak',$this->bim_campak);
		$criteria->compare('bim_bcg',$this->bim_bcg);
		$criteria->compare('bim_dpthb1',$this->bim_dpthb1);
		$criteria->compare('bim_dptbh2',$this->bim_dptbh2);
		$criteria->compare('bim_dpthb3',$this->bim_dpthb3);
		$criteria->compare('bim_tt1',$this->bim_tt1);
		$criteria->compare('bim_tt2',$this->bim_tt2);
		$criteria->compare('bim_polio1',$this->bim_polio1);
		$criteria->compare('bim_polio2',$this->bim_polio2);
		$criteria->compare('bim_polio3',$this->bim_polio3);
		$criteria->compare('bim_polio4',$this->bim_polio4);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}